package com.etl.plugin.datasource.sqlexecute.abs;

import com.etl.plugin.datasource.sqlexecute.BaseSqlExecute;

public abstract class AbsSqlExecute implements BaseSqlExecute {

    public abstract void pool(String connId);


    /**
     * 执行sql
     * @param connId
     * @param sql
     * @param params
     * @return
     */
    @Override
    public String execute(String connId, String sql, Object[] params) {

        try{
            pool(connId);
            return sqlExcute();
        }finally {
            back(connId);
        }
    }

    /**
     * 归还sql
     * @param connId
     */
    public abstract void back(String connId);

    /**
     * sql执行
     * @return
     */
    public abstract String sqlExcute();
}
